package controller;

import shop_servlet.SelectUser;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/search.do")
public class SelectUserController extends HttpServlet {
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        try {
            request.setCharacterEncoding("UTF-8");
            response.setCharacterEncoding("UTF-8");
            String username = request.getParameter("username");
            String user_id = request.getParameter("user_id");
            String phone = request.getParameter("phone");

            SelectUser selectService = new SelectUser();
            /*if(selectService.select_user(username, user_id ,phone) > 0) {
                response.getWriter().print("success!");
            }
            else {
                response.getWriter().print("false!");
            }*/
            response.getWriter().print(selectService.select_user(username, user_id ,phone));
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }


    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
        doGet(request, response);
    }
}

